import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2022-07-29
 * Time: 14:54
 */
public class Test_0729 {

    public static int Max(int a, int b) {
        return a > b ? a : b;
    }

    public static double Max(int a, int b, double c) {
        int ret1 = Max(a, b);
        return ret1 > c ? ret1 : c;
    }

    //求最大值方法的重载
    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        double c = 30.0;
        int ret1 = Max(a, b);
        double ret2 = Max(a, b, c);
        System.out.println(ret1 + " " + ret2);
    }

    //函数得重载中 返回类型可以不一致
    //           函数名必须一致
    //           参数不一样（包括参数类型，参数个数，不同类型下参数得顺序）
    public static int sum(int a, int b) {
        return a + b;
    }

    public static double sum(int a, int b, double c) {
        return (a + b + c);
    }

    //求和重载--在同一个类中,分别定义求两个整数的方法 和 三个小数之和的方法
    public static void main5(String[] args) {
        int a = 10;
        int b = 20;
        double c = 30.0;
        int ret1 = sum(a, b);
        double ret2 = sum(a, b, c);
        System.out.println(ret1);
        System.out.println(ret2);
    }

    public static int Fib(int n) {
        int a = 1;
        int b = 1;
        int c = 0;

        if (n == 0) {
            return 0;
        }
        if (n == 1 || n == 2) {
            return 1;
        }
        for (int i = 3; i <= n; i++) {
            c = a + b;
            a = b;
            b = c;
        }
        return c;
    }

    //求斐波那契数列的第n项。(迭代实现)
    public static void main4(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int ret=Fib(n);
        System.out.println(ret);

    }

    public static int Sumfactorial(int n) {
        int sum = 0;
        while (n > 0) {
            sum += Factorial(n);
            n--;
        }
        return sum;
    }

    //求n的阶乘之和
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ret = Sumfactorial(n);
        System.out.println(ret);
    }

    public static int Factorial(int x) {
        int sum = 1;
        while (x > 0) {
            sum *= x;
            x--;
        }
        return sum;
    }

    //求N的阶乘
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int ret = Factorial(n);
        System.out.println(ret);
    }

    public static int Max3(int a, int b, int c) {
        int ret1 = Max2(a, b);
        return ret1 > c ? ret1 : c;
    }

    public static int Max2(int a, int b) {
        return a > b ? a : b;
    }

    //创建方法求两个数的最大值max2，随后再写一个求3个数的最大值的函数max3
    //要求：在max3这个函数中，调用max2函数，来实现3个数的最大值计算
    public static void main1(String[] args) {
        int a = 10;
        int b = 20;
        int c = 30;
        int MAX2 = Max2(a, b);
        System.out.println(MAX2);
        int MAX3 = Max3(a, b, c);
        System.out.println(MAX3);
    }
}
